// 导入 modules 模块下的所有路由文件
const modules = require.context('./modules', false, /\.js$/);
// 项目路由
const routeModules = [];
// 将 modules 模块下的路由添加到 routeModules 数组当中
modules.keys().forEach((key) => {
  const route = modules(key).default || {};
  const routeList = Array.isArray(route) ? [...route] : [route];
  routeModules.push(...routeList);
});

const NOT_FOUND = {
  path: '*',
  redirect: '/404'
};

export const asyncRoutes = [...routeModules, NOT_FOUND];
console.log(asyncRoutes);
